<?php
require_once("include.php");
	session_start();
	
	//connect database
	$link=mysql_connect(DATABASE_ADDRESS, DATABASE_USER, DATABASE_PASS);
	mysql_select_db(DATABASE_NAME);
	
	//instancier l'utilisateur
	if (isset($_SESSION['active']) and $_SESSION['active'] == 1)
	{
		$user = &$_SESSION['user'];
	}
	else
	{
		$user = new User();
		$_SESSION['user'] = $user;
		$_SESSION['active'] = 1;
		$user->check_cookie();
	}
	//system
	include("system_request.php");
	include("system_ajax.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title><?php echo $html_title ?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<link rel="stylesheet" href="style.css" type="text/css" />
	<link rel="icon" type="image/png" href="img/favicon.ico" />
	<script type="text/javascript" src="fonction.js"></script>
	<script src="js/prototype.js" type="text/javascript"></script>
 	<script src="js/scriptaculous.js?load=effects" type="text/javascript"></script>
</head>
<body>
<?php
		//affichage des erreurs
		$errors = $user->message->getError();
		if (count($errors)>0){
			echo "<div  onclick=\"Effect.Shake(this);\" id=\"div_error\">";
			foreach($errors as $error){
				echo "<p>$error</p>";
			}
			echo "</div>";
			echo "<script>var ele= document.getElementById('div_error');Effect.Shake(ele);</script>";
		}
		//affichage des infos
		$infos = $user->message->getInfo();
		if (count($infos)>0){
			echo "<div id=\"div_info\">";
			foreach($infos as $info){
				echo "<p>$info</p>";
			}
			echo "</div>";
		}
	?>
<div id="popup_contain">
<?php 
if($_GET['page']=='message'){
	include("popup_message.php");
}elseif($_GET['page']=='admin_user'){
	include("popup_admin_user.php");
}elseif($_GET['page']=='admin_server'){
	include("popup_admin_server.php");
}elseif($_GET['page']=='admin_add_user'){
	include("popup_admin_add_user.php");
}elseif($_GET['page']=='admin_add_server'){
	include("popup_admin_add_server.php");
}elseif($_GET['page']=='admin_send_email'){
	include("popup_admin_send_email.php");
}
	
?>

</div>
</body>
</html>